<template>
	<view>
		<view class="home_tab_title">
			<view class="title_inner">
				<uni-segmented-control :current="current" :values="items.map(v=>v.title)" @clickItem="onClickItem" 
				styleType="text" activeColor="#ff8e03"></uni-segmented-control>
			</view>
		</view>
		<view class="home_tab_content">
			<view v-if="current === 0">
				<foodList ref="myflist"></foodList>
		    </view>
			<view v-if="current === 1">
			     <resList ref="myrlist"></resList>
			</view>
			<view v-if="current === 2">
			    <cateList ref="myclist"></cateList>
			</view>
		</view>

	</view>
</template>

<script>
	import { uniSegmentedControl } from "@dcloudio/uni-ui";
	import foodList from "../../list/favlist/favFoodList.vue"
	import resList from "../../list/favlist/favResList.vue"
	import cateList from "../../list/favlist/favCateList.vue"
	export default{
		components:{
			uniSegmentedControl,
			foodList,
			resList,
			cateList
			},		
		data(){
			return{
				items:[{title:"美食"},{title:"商家"},{title:"攻略"}],
				current:0
			}
		},
		methods:{
			onClickItem(e)
			{
				if(this.current!=e.currentIndex){
					this.current=e.currentIndex;
				}
			}
		}
	}
</script>

<style>
</style>
